package com.sgcc.nfc.lock

import android.app.Application
import android.util.Log
import com.amap.api.maps.MapsInitializer
import dagger.hilt.android.HiltAndroidApp
import timber.log.Timber

@HiltAndroidApp
class NfcLockApp : Application() {
    
    companion object {
        private const val TAG = "NfcLockApp"
    }
    
    override fun onCreate() {
        System.out.println("=== NfcLockApp onCreate: 开始 ===")
        Log.d(TAG, "Application onCreate: 开始")
        super.onCreate()
        
        System.out.println("=== NfcLockApp onCreate: 初始化Timber ===")
        Log.d(TAG, "Application onCreate: 初始化Timber")
        if (BuildConfig.DEBUG) {
            Timber.plant(Timber.DebugTree())
        }

        System.out.println("=== NfcLockApp onCreate: 初始化地图SDK ===")
        Log.d(TAG, "Application onCreate: 初始化地图SDK")
        // AMap SDK requires explicit privacy agreement before any map components are used.
        MapsInitializer.updatePrivacyShow(this, true, true)
        MapsInitializer.updatePrivacyAgree(this, true)
        
        System.out.println("=== NfcLockApp onCreate: 完成 ===")
        Log.d(TAG, "Application onCreate: 完成")
    }
}
